import io.renren.modules.poschangetest.dao.PoschangetestDao;
import io.renren.modules.poschangetest.dao.PoschangetestDao;
import io.renren.modules.poschangetest.entity.PoschangetestEntity;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.junit.Before;
import org.junit.Test;

import java.io.Reader;
import java.util.List;

/**
 * @program: Mybatis08
 * @description:
 * @author: jdy
 * @create: 2021-12-08 19:15
 **/

public class testpos {
    private SqlSession session;
    @Before
    public void before() throws Exception{
        Reader reader = Resources.getResourceAsReader("mybatis.xml");
        SqlSessionFactory sessionFactory = new SqlSessionFactoryBuilder().build(reader);
        session=sessionFactory.openSession();
    }
    @Test
    public void test01(){
        PoschangetestDao poschangetestDao = session.getMapper(PoschangetestDao.class);
        List<PoschangetestEntity> pos = poschangetestDao.selectAll();
        System.out.println(pos);
    }
}
